<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title></title>
		<link href="css/mui.min.css" rel="stylesheet" />
		<style type="text/css">
			body {
				background-repeat: no-repeat;
				background-size: cover;
				background-image: url(https://yishusmt.oss-cn-hangzhou.aliyuncs.com/yishusmt_mob/images/waitImg/waitImg1.jpg);
			}
		</style>
	</head>

	<body>
		<!--<img src="https://yishusmt.oss-cn-hangzhou.aliyuncs.com/yishusmt_mob/images/waitImg/waitImg1.jpg" class="hello-img" style="width: 100%;" />-->
	</body>
	<script src="js/mui.min.js"></script>
	<script src="js/myjs/localVarchar.js"></script>
	<script src="js/ipjs/ip.js"></script>
	<script src="js/constatnt/var.js"></script>
	<script type="text/javascript">
		function plusReady() { 
			var localPhone = localStorage.getItem(LOCAL_USER_INFO) == null ? "" : localStorage.getItem(LOCAL_USER_INFO);
			//手机基本信息
			var phoneInfo = {
				"imei": plus.device.imei,
				"model": plus.device.model,
				"vendor": plus.device.vendor,
				"uuid": plus.device.uuid,
				"language": plus.os.language,
				"phone": localPhone
			};
			//将手机信息提交请求
			mui.ajax(ip + '/phoneDetails/getFacility', {
				data: JSON.stringify(phoneInfo),
				dataType: 'json', //服务器返回json格式数据
				type: 'post', //HTTP请求类型
				timeout: 5000, //超时时间设置为5秒；
				headers: {
					'Content-Type': 'application/json'
				},
				success: function(data) {},
				error: function(xhr, type, errorThrown) {}
			});

			//检查更新
			//获取本地版本号
			mui.getJSON("manifest.json", null, function(data) {
				mui.ajax(ip + '/version/versionCode/' + data.version.name, {
					type: 'get', //HTTP请求类型
					timeout: 5000, //超时时间设置为5秒；
					success: function(data) {
						//服务器返回响应，根据响应结果，分析是否登录成功；
						if(data.data.code == NO_TO) {
							jump();
						} else if(data.data.code == HAVE_TO) {
							var btnArray = ['退出', '升级'];
							mui.confirm('您需要升级产品', '提示', btnArray, function(e) {
								if(e.index == 1) {
									plus.runtime.openURL(data.data.object.url);
									plus.runtime.quit();
								} else {
									plus.runtime.quit();
								}
							})
						} else if(data.data.code == NO_NEED) {
							jump();
						}
					},
					error: function(xhr, type, errorThrown) {
						//异常处理；
						mui.toast("获取版本失败！");
					}
				});
			});

		}
		function jump() {
			//获取用户本地信息(后期验证加密)
			var userLocalInfo = localStorage.getItem(LOCAL_USER_INFO);
			//			远程拦截器，判断其用户的有效信息，判断登陆或者注册				
			if(userLocalInfo == null || userLocalInfo == "undefined" || userLocalInfo == "null" || userLocalInfo == "") {
				//用户不存在 跳转到登录页面
				window.location.href = "login.html";
			} else {
				//			将本地用户请求服务器查询信息
				mui.ajax(ip + '/userRegister/selectNowUser/' + userLocalInfo, {
					type: 'get', //HTTP请求类型
					timeout: 5000, //超时时间设置为5秒；
					success: function(data) {
						//服务器返回响应，根据响应结果，分析是否登录成功；
						if(data.data.status = OPERATION_SUCCESS) {
							window.location.href = "index-homePage.html";
						} else {
							window.location.href = "reg.html";
						}
					},
					error: function(xhr, type, errorThrown) {
						//异常处理；
						var btnArray = ['联系', '退出'];
						mui.confirm('请求错误，请您稍后再试', '警告', btnArray, function(e) {
							if(e.index == 1) {
								plus.runtime.quit();
							} else {
								location.href = "html/humanServices/human.html";
							}
							//发送异常邮件
							mui.ajax(ip + '/send/exception', {
								type: 'get', //HTTP请求类型
								timeout: 5000, //超时时间设置为5秒；
								success: function(data) {},
								error: function(xhr, type, errorThrown) {}
							});
						});
					}
				});
			}
		}
		document.querySelector('body').style.height = window.screen.height - 20 + "px";
		document.querySelector('body').style.width = window.screen.width + "px";
		if(window.plus) {
			plusReady();
		} else {
			document.addEventListener("plusready", plusReady, false);
		}
	</script>

</html>